/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.company.management.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Paner
 */
@Entity
@Table(name = "employeegroup", catalog = "cafedb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EmployeeGroup.findAll", query = "SELECT e FROM EmployeeGroup e"),
    @NamedQuery(name = "EmployeeGroup.findById", query = "SELECT e FROM EmployeeGroup e WHERE e.id = :id"),
    @NamedQuery(name = "EmployeeGroup.findByName", query = "SELECT e FROM EmployeeGroup e WHERE e.name = :name"),
    @NamedQuery(name = "EmployeeGroup.findByHourlyrateofpayment", query = "SELECT e FROM EmployeeGroup e WHERE e.hourlyrateofpayment = :hourlyrateofpayment")})
public class EmployeeGroup implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "NAME", nullable = false, length = 255)
    private String name;
    @Basic(optional = false)
    @Column(name = "HOURLYRATEOFPAYMENT", nullable = false)
    private float hourlyrateofpayment;
    @OneToMany(mappedBy = "groupid", fetch = FetchType.LAZY)
    private List<Employee> employeeList;

    public EmployeeGroup() {
    }

    public EmployeeGroup(Integer id) {
        this.id = id;
    }

    public EmployeeGroup(Integer id, String name, float hourlyrateofpayment) {
        this.id = id;
        this.name = name;
        this.hourlyrateofpayment = hourlyrateofpayment;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public float getHourlyrateofpayment() {
        return hourlyrateofpayment;
    }

    public void setHourlyrateofpayment(float hourlyrateofpayment) {
        this.hourlyrateofpayment = hourlyrateofpayment;
    }

    @XmlTransient
    public List<Employee> getEmployeeList() {
        return employeeList;
    }

    public void setEmployeeList(List<Employee> employeeList) {
        this.employeeList = employeeList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EmployeeGroup)) {
            return false;
        }
        EmployeeGroup other = (EmployeeGroup) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.company.management.EmployeeGroup[ id=" + id + " ]";
    }
    
}
